package com.kingland.springbootstarterdataredis.mapper;

import com.kingland.springbootstarterdataredis.model.StudentModel;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;

import java.util.List;

public interface StudentMapper {

    /**
     * Query all data
     *
     */
    List<StudentModel> findAll();

    /**
     * Query individual data by ID
     *
     */
    StudentModel findById(Long id);

    /**
     * Query the data of a specified row
     *
     */
    List<StudentModel> queryAllByLimit(StudentModel userInfo, @Param("pageable") Pageable pageable);

    /**
     * Count the total number of rows
     *
     */
    long count(StudentModel userInfo);

    /**
     * Added data
     *
     */
    int save(StudentModel userInfo);

    /**
     * Add data in batches (My Batis native foreach method)
     *
     */
    int insertBatch(@Param("entities") List<StudentModel> entities);

    /**
     * Add data in batches or update data by primary key (My Batis native foreach method)
     *
     */
    int insertOrUpdateBatch(@Param("entities") List<StudentModel> entities);

    /**
     * Modify the data
     *
     */
    int update(StudentModel userInfo);

    /**
     * Delete data via primary key
     *
     */
    int deleteById(Long id);
}
